#include "Common.hpp"

class Client
{
public:
    Client() : _fd(-1)
    {
    }
    bool OpenforWrite()
    {
        int n = Openpipe(O_WRONLY);
        if(n > 0)
        {
            _fd = n;
            return true;
        }
        return false;
    }
    // std::string *: 输出型参数
    // const std::string &: 输入型参数
    // std::string &: 输入输出型参数
    int Wirtepipe(const std::string &in)
    {
        ssize_t n = ::write(_fd,in.c_str(),strlen(in.c_str()));
        if(n > 0)
        {
            std::cout << "写入成功" << std::endl;
            return n;            
        }
        else return 0;
    }
    void ClosePipe()
    {
        CloseHelper(_fd);
    }
    ~Client()
    {
    }

private:
    int _fd;
};
